package com.sky.controller.admin;

import com.sky.dto.RecordVideoDto;
import com.sky.entity.RecordVideo;
import com.sky.exception.BaseException;
import com.sky.result.Result;
import com.sky.service.RecordVideoService;
import com.sky.vo.RecordVideoVO;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName: xiaoZhang
 * @Description:
 * @Author: Zhang
 * @CreateDate: 2025-05-14 16:02
 */
@RestController
@RequestMapping("/record")
@Slf4j
@ApiOperation("")
public class RecordVideoController {
    @Autowired
    private RecordVideoService recordVideoService;
    @PostMapping("/save")
    public Result<String> saveRecordVideo(@RequestBody RecordVideoDto recordVideoDto) {
        if(recordVideoDto == null) {
            throw new BaseException("上送参数为空");
        }
        log.info("可回溯入参:{}", recordVideoDto);
        recordVideoService.saveRecordVideo(recordVideoDto);
        return Result.success("更新成功");
    }

    @PostMapping("/qryRecords")
    public Result<RecordVideo> queryRecordVideo(@RequestBody RecordVideoDto recordVideoDto) {
       RecordVideo recordVideo = recordVideoService.queryRecordVideo(recordVideoDto.getRecordId());
       return Result.success(recordVideo);
    }
}
